/*
 * Powered By 
 * Since 2010 - 2016
 */

package com.rf.business.control;

import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;



import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.rf.sys.frm.BaseController;
import com.rf.sys.utils.ConfigUtils;
import com.rf.sys.utils.JsonUtils;
import com.rf.sys.utils.PageUtils;
import com.rf.business.model.CardRelease;
import com.rf.business.service.CardReleaseSearchService;

@Controller
@RequestMapping("/bus/cardReleaseSearch")
public class CardReleaseSearchController extends BaseController{
	/**
	 * 日志
	 */
	private static Logger log = LoggerFactory.getLogger(CardReleaseSearchController.class);
	
	@Resource
	private CardReleaseSearchService cardReleaseSearchService;
    
    /**
  	 * 终检亭入境放行卡查询
  	 * @param Page,request,response
  	 * @throws ServletException,IOException
  	 */
      @RequestMapping(value = "query1")
      @ResponseBody
      public void query1 (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
      	//获取分页、查询参数，进行数据封装
    	cardRelease.setEntryExitType(ConfigUtils.CLRJ);  // 出入境类型   101101车辆入境
      	Map searchMap = cardReleaseSearchService.getCardReleasePage(cardRelease, pageUtils);
      	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
      }
      /**
    	 * 终检亭出境放行卡查询
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "query2")
        @ResponseBody
        public void query2 (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getCardReleasePage(cardRelease, pageUtils);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        /**
    	 * 入境放行卡
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "query3")
        @ResponseBody
        public void query3 (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLRJ);  // 出入境类型   101101车辆入境
        	Map searchMap = cardReleaseSearchService.getCardReleasePage(cardRelease, pageUtils);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        /**
    	 * 南卡口出境放行卡
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "query4")
        @ResponseBody
        public void query4 (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getCardReleasePage(cardRelease, pageUtils);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        /**
    	 * 客车待检区出境放行卡查询
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "query5")
        @ResponseBody
        public void query5 (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getCardReleasePage(cardRelease, pageUtils);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 综合统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "sum")
        @ResponseBody
        public void getSum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	
        	//
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	
        	Map searchMap = cardReleaseSearchService.getSumPage(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 入境时间统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "insumtime")
        @ResponseBody
        public void getInSumTime (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLRJ);  // 出入境类型   101101车辆入境
        	Map searchMap = cardReleaseSearchService.getSumTimePage(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 出境时间统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "outsumtime")
        @ResponseBody
        public void getOutSumTime (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getSumTimePage(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 口岸物业验放统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getkawysum")
        @ResponseBody
        public void getkawysum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getkawysum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 口岸物业验放明细
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getkawymx")
        @ResponseBody
        public void getkawymx (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getkawymx(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 旅行社接车统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getlxsjc")
        @ResponseBody
        public void getlxsjc (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getlxsjc(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 车辆类型统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getcartypesum")
        @ResponseBody
        public void getcartypesum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getcartypesum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 车辆进出境统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getinoutsum")
        @ResponseBody
        public void getinoutsum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getinoutsum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 入境未出区统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getinsum")
        @ResponseBody
        public void getinsum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getinsum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 进去未出区统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getoutsum")
        @ResponseBody
        public void getoutsum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	Map searchMap = cardReleaseSearchService.getoutsum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
        
        /**
    	 * 入境停留车辆人数统计
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "getinpersonsum")
        @ResponseBody
        public void getinpersonsum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.getSumTimePage(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }

//20161207荆有玺新增退车统计
        /**
    	 * 退车统计 
    	 * @param Page,request,response
    	 * @throws ServletException,IOException
    	 */
        @RequestMapping(value = "returncarsum")
        @ResponseBody
        public void returncarsum (PageUtils pageUtils, CardRelease cardRelease, HttpServletRequest request, HttpServletResponse response ) throws Exception{
        	String startdate=request.getParameter("startdate");
        	String enddate=request.getParameter("enddate");
        	//获取分页、查询参数，进行数据封装
        	//cardRelease.setEntryExitType(ConfigUtils.CLCJ);  // 出入境类型   101102车辆出境
        	Map searchMap = cardReleaseSearchService.returncarsum(cardRelease, pageUtils,startdate,enddate);
        	super.responsePrint(request, response, JsonUtils.mapToJson(searchMap));
        }
}


